package com.gxa.saas.portal.mapper;

import com.gxa.saas.core.vo.EditOderVo;
import com.gxa.saas.core.vo.TbAddressVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


/**
 * @Auther: pengxtao
 * @Date: 2022/7/24下午12:13
 */
@Mapper//表示持久层
public interface ProductMapper {

    @Select("SELECT \n" +
            "product.pr_name\n" +
            "FROM\n" +
            "product WHERE pr_id=#{prId}")
    public String selectPrName(@Param("prId") String prId);

    @Select("INSERT INTO tb_order(od_id,com_name,com_num,od_price,od_time,od_number,od_status,user_id)" +
            " VALUES (#{id},#{prName},#{prNum},#{totalPrice},#{odTime},#{oederId},#{status},#{userId})")
    public void insertIndent(EditOderVo editOderVo);

    @Select("SELECT id FROM product WHERE pr_id = #{prId}")
    public String selectPrIdAndId(@Param("prId") String prId);

    @Select("UPDATE tb_order SET sh_address=#{adAddress},sh_name=#{adName},sh_phone=#{adPhone} WHERE od_number=#{oederId}")
    public void insertIndents(TbAddressVo tbAddressVo);

    @Select("UPDATE tb_order SET od_status=1 WHERE od_number=#{oderId}")
    public void updateOrderStatus(@Param("oderId") String oderId);

}
